package com.noocodecommit.wicket.jquery.plugin.enchant.slide;

import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.markup.html.AjaxLink;
import org.apache.wicket.markup.html.basic.Label;

import com.noocodecommit.wicket.jquery.TemplatePage;
import com.noocodecommit.wicket.stuff.jquery.JQCore;
import com.noocodecommit.wicket.stuff.jquery.plugin.chili.JQChili;
import com.noocodecommit.wicket.stuff.jquery.plugin.effects.JQAnimation;
import com.noocodecommit.wicket.stuff.jquery.plugin.effects.JQAnimationUtils;
import com.noocodecommit.wicket.stuff.jquery.plugin.effects.slide.JQSlide;
import com.noocodecommit.wicket.stuff.jquery.plugin.effects.slide.JQSlideOptions;
import com.noocodecommit.wicket.stuff.jquery.plugin.effects.slide.JQSlidePlugin;

public class SlidePage extends TemplatePage
{
	public SlidePage()
	{
		super();
		this.setupChili();

		// -- Init effect plugin
		JQCore.get().bindPlugin(new JQSlidePlugin());

		final Label block = new Label("block", "block");
		block.setOutputMarkupId(true);
		add(block);

		add(new AjaxLink("effect4")
		{
			public void onClick(AjaxRequestTarget target)
			{
				target.appendJavascript(JQAnimation.hide(block, new JQSlide(JQSlideOptions.DIRECTION_UP)) + "showCode(0);");
			}
		});
		add(new AjaxLink("effect5")
		{
			public void onClick(AjaxRequestTarget target)
			{
				JQAnimationUtils.create(block).animation(new JQSlide(JQSlideOptions.DIRECTION_UP)).show(target);
			}
		});
		add(new AjaxLink("effect6")
		{
			public void onClick(AjaxRequestTarget target)
			{
				JQAnimationUtils.create(block).animation(new JQSlide(JQSlideOptions.DIRECTION_UP)).toggle(target);
			}
		});
		add(new AjaxLink("effect7")
		{
			public void onClick(AjaxRequestTarget target)
			{
				JQAnimationUtils.create(block).animation(new JQSlide(JQSlideOptions.DIRECTION_RIGHT)).hide(target);
			}
		});
		add(new AjaxLink("effect8")
		{
			public void onClick(AjaxRequestTarget target)
			{
				JQAnimationUtils.create(block).animation(new JQSlide(JQSlideOptions.DIRECTION_RIGHT)).show(target);
			}
		});
		add(new AjaxLink("effect9")
		{
			public void onClick(AjaxRequestTarget target)
			{
				JQAnimationUtils.create(block).animation(new JQSlide(JQSlideOptions.DIRECTION_RIGHT)).toggle(target);
			}
		});
		add(new AjaxLink("effect10")
		{
			public void onClick(AjaxRequestTarget target)
			{
				JQAnimationUtils.create(block).animation(new JQSlide(JQSlideOptions.DIRECTION_DOWN)).hide(target);
			}
		});
		add(new AjaxLink("effect11")
		{
			public void onClick(AjaxRequestTarget target)
			{
				JQAnimationUtils.create(block).animation(new JQSlide(JQSlideOptions.DIRECTION_DOWN)).show(target);
			}
		});
		add(new AjaxLink("effect12")
		{
			public void onClick(AjaxRequestTarget target)
			{
				JQAnimationUtils.create(block).animation(new JQSlide(JQSlideOptions.DIRECTION_DOWN)).toggle(target);
			}
		});
		add(new AjaxLink("effect13")
		{
			public void onClick(AjaxRequestTarget target)
			{
				JQAnimationUtils.create(block).animation(new JQSlide(JQSlideOptions.DIRECTION_LEFT)).hide(target);
			}
		});
		add(new AjaxLink("effect14")
		{
			public void onClick(AjaxRequestTarget target)
			{
				JQAnimationUtils.create(block).animation(new JQSlide(JQSlideOptions.DIRECTION_LEFT)).show(target);
			}
		});
		add(new AjaxLink("effect15")
		{
			public void onClick(AjaxRequestTarget target)
			{
				JQAnimationUtils.create(block).animation(new JQSlide(JQSlideOptions.DIRECTION_LEFT)).toggle(target);
			}
		});

		JQChili chili1 = new JQChili("chili1");
		add(chili1);
		this.bindChiliCode(chili1, this.getClass(), "html");

		JQChili chili2 = new JQChili("chili2");
		add(chili2);
		this.bindChiliCode(chili2, this.getClass(), "java");

		JQCore.get().bindOnDocumentReadyFunction();
	}
}
